class BloodSplatter extends Sprite
{
  final float DROP_SIZE = .5f;
  
  public PVector location;
  public float frame;
  public float health;
  public color c;
  public ArrayList<PVector> locations;
  
  
  public BloodSplatter(PVector _location, int type)
  {
   this.location = _location; 
   this.damage = 50;
   this.spriteSize = DROP_SIZE;
   locations = new ArrayList<PVector>();
   frame = 0;
   health = 100;
   if(type==1)
   {
    c = color(100,200,100); 
   } else
   {
    c = color(250, 50, 0); 
   }
  }
  
  public void draw()
  {
    locations.clear();
    frame++;
    if(frame>50)
    {
     health=0; 
    }
    pushMatrix();
    fill(c);
    noStroke();
    translate(location.x, location.y+frame, location.z);
    
    float xOffset=0;
    float yOffset=0;
    float zOffset=0;
    //drop 1
    pushMatrix();
      yOffset = -(frame/4)*(frame/4)+(frame/4);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(location.x+xOffset, location.y+yOffset, location.z+zOffset));
    popMatrix();
    
    //drop2
    pushMatrix();
      yOffset = -(frame/4)*(frame/4)-(frame/4);
      xOffset = (frame/4);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(0).x+xOffset, locations.get(0).y+yOffset, locations.get(0).z+zOffset));
    popMatrix();
    
    //drop3
    pushMatrix();
      yOffset = -(frame/4)*(frame/4)+(frame/4);
      zOffset = (frame/4);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(1).x+xOffset, locations.get(1).y+yOffset, locations.get(1).z+zOffset));
    popMatrix();
    
    //drop4
    pushMatrix();
      zOffset = -(frame/8);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(2).x+xOffset, locations.get(2).y+yOffset, locations.get(2).z+zOffset));
    popMatrix();
    
    //drop5
    pushMatrix();
      yOffset = -(frame/2)*(frame/4)-(frame/3);
      xOffset = -(frame/8);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(3).x+xOffset, locations.get(3).y+yOffset, locations.get(3).z+zOffset));
    popMatrix();
    
    //drop6
    pushMatrix();
      zOffset = (frame/8);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(4).x+xOffset, locations.get(4).y+yOffset, locations.get(4).z+zOffset));
    popMatrix();
    
    //drop 7
    pushMatrix();
      yOffset = -(frame/4)*(frame/4);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(5).x+xOffset, locations.get(5).y+yOffset, locations.get(5).z+zOffset));
    popMatrix();
    
    //drop8
    pushMatrix();
      xOffset = (frame/3);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(6).x+xOffset, locations.get(6).y+yOffset, locations.get(6).z+zOffset));
    popMatrix();
    
    //drop9
    pushMatrix();
    yOffset = -(frame/6)*(frame/6)-(frame/4);
      zOffset = (frame/6);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(7).x+xOffset, locations.get(7).y+yOffset, locations.get(7).z+zOffset));
    popMatrix();
    
    //drop10
    pushMatrix();
    yOffset = -(frame/3)*(frame/4);
      zOffset = -(frame/10);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(8).x+xOffset, locations.get(8).y+yOffset, locations.get(8).z+zOffset));
    popMatrix();
    
    //drop11
    pushMatrix();
      xOffset = -(frame/10);
      translate(xOffset, yOffset, zOffset);
      box(DROP_SIZE);
      locations.add(new PVector(locations.get(9).x+xOffset, locations.get(9).y+yOffset, locations.get(9).z+zOffset));
    popMatrix();
    
    popMatrix();
  }
}
